package com.alibaba.citrus.ots.sales.plan.repository;

import com.alibaba.citrus.ots.sales.plan.dto.api.request.PageQueryDepartmentTaskCountRequest;
import com.alibaba.citrus.ots.sales.plan.dto.api.request.PageQueryPlanScItemStatRequest;
import com.alibaba.citrus.ots.sales.plan.dto.api.request.QueryPlanCustomerStatRequest;
import com.alibaba.citrus.ots.sales.plan.dto.api.request.QueryPlanScItemStatRequest;
import com.alibaba.citrus.ots.sales.plan.dto.api.request.SalesPlanScItemStatSubTotalRequest;
import com.alibaba.citrus.ots.sales.plan.repository.request.BatchQueryPlanScItemRequest;
import com.alibaba.citrus.ots.sales.plan.repository.request.StatCategoryQueryRequest;
import com.alibaba.citrus.ots.sales.plan.repository.request.StatOrganizationQueryRequest;
import com.alibaba.citrus.ots.sales.plan.sdo.SalesPlanStatScItemSDO;
import com.alibaba.cz.base.model.enterprise.OrganizationSDO;
import com.alibaba.cz.base.tool.page.PageResult;

import java.util.List;

/**
 * @author yuhailin
 * @description:
 * @date 2021-09-27 10:43
 */
public interface SalesPlanScItemStatRepository {
    /**
     * 批量更新计划货品信息
     *
     * @param salesPlanScItemStatSDO
     * @return
     */
    Boolean batchEditSalesPlanScItem(SalesPlanStatScItemSDO salesPlanScItemStatSDO);

    /**
     * 分页查询计划货品
     *
     * @param pageQueryPlanScItemStatRequest
     * @return
     */
    PageResult<List<SalesPlanStatScItemSDO>> pageQueryPlanScItemList(PageQueryPlanScItemStatRequest pageQueryPlanScItemStatRequest);

    /**
     * 查询部门任务量
     *
     * @param queryDepartmentTaskCount
     * @return
     */
    PageResult<List<SalesPlanStatScItemSDO>> queryDepartmentTaskCountList(PageQueryDepartmentTaskCountRequest queryDepartmentTaskCount);

    /**
     * 根据bizIds批量查询计划货品
     *
     * @param queryPlanScItemStatRequest
     * @return
     */
    PageResult<List<SalesPlanStatScItemSDO>> batchQueryPlanScItemByBizId(QueryPlanScItemStatRequest queryPlanScItemStatRequest);

    /**
     * 根据planId,scItemId查询计划货品
     *
     * @param queryPlanScItemStatRequest
     * @return
     */
    List<SalesPlanStatScItemSDO> queryPlanScItemByPlanId(QueryPlanScItemStatRequest queryPlanScItemStatRequest);

    /**
     * 计划-货品维度-根据id查询计划货品
     *
     * @param queryPlanScItemStatRequest
     * @return
     */
    SalesPlanStatScItemSDO getSalesPlanScItem(QueryPlanScItemStatRequest queryPlanScItemStatRequest);

    /**
     * 编辑计划货品
     *
     * @param salesPlanScItemStatSDO
     * @return
     */
    Boolean editSalesPlanScItem(SalesPlanStatScItemSDO salesPlanScItemStatSDO);

    /**
     * 更新计划货品
     *
     * @param salesPlanScItemStatSDO
     * @return
     */
    Boolean updatePlanScItem(SalesPlanStatScItemSDO salesPlanScItemStatSDO);

    /**
     * 保存计划货品
     * @param sdo
     * @return
     */
    String createPlanScItem(SalesPlanStatScItemSDO sdo);

    /**
     * 根据id获取子孙组织
     * @param queryPlanCustomerStatRequest
     * @return
     */
    List<OrganizationSDO> getAllChildOrganizations(QueryPlanCustomerStatRequest queryPlanCustomerStatRequest);

    /**
     * 批量查询计划货品（不含调整）
     *
     * @param request
     * @return
     */
    List<SalesPlanStatScItemSDO> batchQueryPlanScItem(BatchQueryPlanScItemRequest request);

    /**
     * 批量保存计划货品
     *
     * @param requestList
     * @return
     */
    Boolean batchCreatePlanScItem(List<SalesPlanStatScItemSDO> requestList);

    /**
     * 批量删除计划货品
     * @param planId
     * @return
     */
    Boolean deletePlanScItemByPlanId(String planId);

    /**
     * 组织维度汇总
     * @param statQueryRequest
     * @return
     */
    List<SalesPlanStatScItemSDO> statOrganization(StatOrganizationQueryRequest statQueryRequest);

    /**
     * 类目维度汇总
     * @param statQueryRequest
     * @return
     */
    List<SalesPlanStatScItemSDO> statCategory(StatCategoryQueryRequest statQueryRequest);

    /**
     * 月度计划货品小计
     * @param salesPlanScItemStatSubTotalRequest
     * @return
     */
    SalesPlanStatScItemSDO subTotalSalesPlanScItemStat(SalesPlanScItemStatSubTotalRequest salesPlanScItemStatSubTotalRequest);
}
